# Python __dict__属性：查看对象内部所有属性名和属性值组成的字典
class CLanguage:
    a = 1
    b = 2
    def __init__(self):
        self.name = "C语言中文网"
        self.add = "http://c.biancheng.net"

# 通过类名调用__dict__
print(CLanguage.__dict__)

# 通过类实例对象调用__dict__
clangs = CLanguage()
print(clangs.__dict__)
print()

class CLanguage:
    a = 1
    b = 2
    def __init__(self):
        self.name = "C语言中文网"
        self.add = "http://c.biancheng.net"

class CL(CLanguage):
    c = 1
    d = 2
    def __init__(self):
        self.na = "Python教程"
        self.ad = "http://c.biancheng.net/python/"

# 父类名调用__dict__
print(CLanguage.__dict__)
# 子类名调用__dict__
print(CL.__dict__)

# 父类实例对象调用__dict__
clangs = CLanguage()
print(clangs.__dict__)
# 子类实例对象调用__dict__
cl = CL()
print(cl.__dict__)
print()

class CLanguage:
    a = "aaa"
    b = 2
    def __init__(self):
        self.name = "C语言中文网"
        self.add = "http://c.biancheng.net"

# 通过类实例对象调用__dict__
clangs = CLanguage()
print(clangs.__dict__)
clangs.__dict__['name'] = "Python教程"
print(clangs.name)
